This option determines the model the compiler uses in deciding whether or not to assume that the memory references it generates are well aligned. If n=1, it assumes well-aligned references unless it can determine otherwise (except in circumstances like struct copies where the ABI alignment requirements don't normally imply alignment).
If n=2, it always analyzes alignment based on the actual expression used, and trusts casts in the source code to reflect actual alignment. For example, consider the expression:
*(type_a *) &b
The declared type of b
implies a certain minimum alignment, as does the cast to type_a
; the compiler uses the maximum of the two.
If n=3
, the compiler also analyzes alignment, but does not trust casts. In the above example, it assumes the alignment of the declared type of b
.